<?php
/*************************************************************************************
 *
 *	FileName: header_php.php
 *	Desc    : ajax supporting deletetion of the picture
 *	Author  : Seal
 *	Date    : 2010-1-25
 *
 *************************************************************************************/
	if( !isset($_POST['pid']) || !is_numeric($_POST['pid'])|| GetLoginUserID()===false)
	{
		echo "非法的删除图片请求！";
		edp_exit();
	}
	
	$userDAO = GetUserDAO();
	$picPath = "";
	
	// here we don't need to check the user permission because in the DAO
	// we will delete only the pic that belongs to this user
	// yawei
	$result = $userDAO->DeletePic( GetLoginUserID(), intval($_POST['pid']) , $picPath);
	
	if( $result == 0)
	{
		@unlink( EdpGetPicPath($picPath) );
		@unlink( EdpGetSmallPicPath($picPath) );
		echo "图片删除成功";
	}
	else
		echo "删除失败！请稍后再试。。。";
		
	edp_exit();
	
?>